	<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改兽药出库记录')" />
	<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-ncDrugsLogs-edit" th:object="${ncDrugsLogs}">
		<input id="drugLogId" name="drugLogId" th:field="*{drugLogId}"  type="hidden">

		<input id="treeId" name="treeId" type="hidden" th:field="*{drugId}"/>
		<input id="drugId" name="drugId" type="hidden" th:field="*{drugId}"/>
		<div class="form-group">`
			<label class="col-sm-3 control-label">药品名称：</label>
			<div class="col-sm-8">
				<div class="input-group">
					<input class="form-control" type="text" onclick="selectYaoTree()" id="treeName" readonly="true"  name="drugName" />
					<span class="input-group-addon"><i class="fa fa-search"></i></span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">出库数量：</label>
			<div class="col-sm-8">
				<input id="outputAmount" name="outputAmount" th:field="*{outputAmount}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">单位：</label>
			<div class="col-sm-8">
				<input id="unit" name="unit" th:field="*{unit}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">出库时间：</label>
			<div class="col-sm-8">
				<input id="createTime"  data-format="yyyy-MM-dd HH:mm:ss" name="createTime" required
					   th:value="*{#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd hh:mm:ss')}" class="form-control"
					   type="text" th:class="time-input">
			</div>
		</div>
		<!--<div class="form-group">
            <label class="col-sm-3 control-label">经手人：</label>
            <div class="col-sm-8">
                <select id="createBy" name="createBy" class="form-control select2-multiple" multiple>
                    <option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}" th:field="*{createBy}"></option>
                </select>
            </div>
        </div>-->
		<div class="form-group">
			<label class="col-sm-3 control-label">领用人：</label>
			<div class="col-sm-8">
				<select id="receiver" name="receiver" class="form-control select2-multiple">
					<option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}" th:field="*{receiver}"></option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">备注：</label>
			<div class="col-sm-8">
				<textarea rows="4" name="remark" th:field="*{remark}" class="form-control" type="text"></textarea>
			</div>
		</div>
	</form>
</div>
<div th:include="include::footer"></div>
<th:block th:include="include :: select2-js" />

<script type="text/javascript">
	var prefix = ctx + "system/ncDrugsLogs";



	//加载药品树start
	function selectYaoTree() {
		var options = {
			title: '药品选择',
			width: "380",
			url: prefix + "/selectYaoTree/"+ $("#treeId").val(),
			callBack: doSubmit
		};
		$.modal.openOptions(options);

	}
	function doSubmit(index, layero) {
		var body = layer.getChildFrame('body', index);
		$("#treeId").val(body.find('#treeId').val());
		$("#treeName").val(body.find('#treeName').val());
		$("#drugId").val(body.find('#treeId').val());
		layer.close(index);
	}
	//加载药品树end

	$("#form-ncDrugsLogs-edit").validate({
        rules: {
            outputAmount: {
                required: true,
                digits: true
            }

        },
        messages: {
            outputAmount: "出库数必须为正整数"
        },
        focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/edit", $('#form-ncDrugsLogs-edit').serialize());
		}
	}
</script>
</body>
</html>
